/*
 * @Author: wangming
 * @Date: 2021-07-12 14:06:56
 * @LastEditors: wangming
 * @LastEditTime: 2022-03-24 16:15:15
 * @FilePath: /hanma-application-designer-fed/src/pageComponents/components/__form/hlVueComponent/index.js
 * @Description:自定义组件
 */
import myMixin from '@/pageComponents/myMixin';
import vmMixin from '@/pageComponents/vmMixin';
import { getVueComponent } from "@/utils/common.js";
export default {
    mixins: [myMixin, vmMixin],
    computed: {
        vueComponent() {
            return getVueComponent(this.config.__config.renderJsx)
        }
    },
    vmEvents: {
        getVue() {
            return this.$refs.vue
        }
    },
    render(h) {
        if (this.isEdit) return <div>Vue组件(预览模式查看)</div>
        if (!this.config.__config.renderJsx) {
            return ''
        }
        return h(this.vueComponent, {
            ref: 'vue',
            attrs: {
                value: this.value,
                context: this.vmEvents.context
            },
            on: {
                input: v => {
                    this.$emit('input', v)
                    this.runEventName("change", { values: v });
                }
            }
        })
    }
};
